﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="buildorderGD.aspx.cs" Inherits="TogoHome_buildorderGD" %>

<%@ Register Src="~/Banner.ascx" TagPrefix="top" TagName="banner" %>
<%@ Register Src="~/header.ascx" TagName="banner" TagPrefix="uc1" %>
<%@ Register Src="~/Foot.ascx" TagPrefix="foot" TagName="foot" %>
<%@ Register Src="~/shop/Left.ascx" TagName="LeftBanner" TagPrefix="uc2" %>


<%@ Register TagPrefix="epc" Namespace="Hangjing.Control" Assembly="Hangjing.Control" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>门店下单 - <%= WebUtility.GetWebName() %></title>
    <link href="/user/css/userinfo.css" rel="stylesheet" type="text/css" />
    <link href="/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/user/css/common.css" rel="stylesheet" type="text/css" />

    <script src="../JavaScript/jquery-1.3.2.js" type="text/javascript"></script>

    <script src="../JavaScript/ShowDivDialog.js" type="text/javascript"></script>

    <script src="../javascript/DatePicker/WdatePicker.js" type="text/javascript"></script>


    <script src="http://webapi.amap.com/maps?v=1.3&key=a67a08405e309385f32f3ef2acc8929c"></script>


    <script src="/javascript/AMap.js"></script>

    <script src="../javascript/sendfee.js"></script>
    <script src="../javascript/spin.min.js"></script>



    <style type="text/css">
        #cblweekday {
            float: left;
        }

        .mynotice {
            background-color: #F1FAFE;
            border: 1px solid #B1DFF3;
            padding: 3px;
            color: #0863C0;
            _padding-top: 6px;
            margin-left: 3px;
            display: inline;
        }

        .hidden {
            display: none;
        }

        .quick_note_control span {
            border: 1px solid #CCCCCC;
            cursor: pointer;
            font-size: 12px;
            margin-right: 3px;
            padding: 4px 8px 3px 8px;
            display: inline-block;
            white-space: nowrap;
            margin-bottom: 5px;
            line-height: 20px;
        }

        .quick_note_control {
            width: 500px;
        }

            .quick_note_control .selectedbg {
                background-color: #f1fafc;
            }

            .quick_note_control .cull {
                background: none repeat scroll 0 0 #FFF0DF;
                color: #ff8400;
            }
    </style>

    <script type="text/javascript">


        function showmap() {
            var tbaddress = $("#tbaddress").val() + "";
            if (tbaddress == "") {
                alert("请输入您的地址");
                return;
            }
            setPlace();
        }


      

        //点击获取用户地址
        function getmyaddress() {
            var tel = $("#tbtel").val();
            if (tel == "") {
                alert("请输入电话");
                return;
            }
            window.location = "buildorder.aspx?tel=" + tel + "&start=1";
            return false;
        }




    </script>



</head>
<body>
    <form id="form1" runat="server">
        <asp:HiddenField runat="server" ID="hidLat" />
        <asp:HiddenField runat="server" ID="hidLng" />
        <asp:HiddenField runat="server" ID="hidlocalflag" />

        <asp:HiddenField runat="server" ID="hftid" />
        <asp:HiddenField runat="server" ID="add_dataid" Value="0" />


        <asp:HiddenField runat="server" ID="hfcityname" Value="全国" />
        <asp:HiddenField runat="server" ID="hfcitycode" Value="0" />

        <top:banner ID="Banner1" runat="server" />
        <uc1:banner ID="Banner2" runat="server" />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

                <div class="shop_containner clearfix">

                    <uc2:LeftBanner runat="server" ID="Left" />

                    <div class="shop_main">
                        <div class="main-content">


                            <h1 class="topbg">门店下单</h1>



                            <div class="usermima">
                                <ul>
                                   
                                    <li><span class="left_span">电话<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbtel" CanBeNull="必填" Width="160px" class="required-entry input_on"></epc:TextBox>
                                        <span id="lbtelmsg" runat="server" style="color: red;"></span>
                                        <input type="button" class="subBtn" onclick="getmyaddress()" id="btgetaddress" value="获取地址" />
                                    </li>
                                     <li><span class="left_span">姓名<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbuname" CanBeNull="必填" Width="160px" class="required-entry input_on"></epc:TextBox>
                                        <span></span>
                                    </li>

                                    <li>
                                        <div class=" noseeitem" style="padding-left: 65px;">
                                            <ul class="myadd_ul">
                                                <asp:Repeater runat="server" ID="rptaddress">
                                                    <ItemTemplate>
                                                        <li>
                                                            <input type="radio" id="addrlist_<%# Eval("dataid") %>" name="addressradio1" <%#(Container.ItemIndex+1).ToString() == "1" ? "checked" : "" %>
                                                                class="radio1 <%#(Container.ItemIndex+1).ToString() == "1" ? "first_addr" : "" %>"
                                                                onclick="setaddress(this);" value="<%# Eval("Receiver") %>^<%# Eval("Address")%>^<%# Eval("lat") %>^<%# Eval("lng")%>^<%# Eval("dataid") %>^<%# Eval("BuildingID") %>" />
                                                            <label for="addrlist_<%# Eval("dataid") %>"><%# Eval("Receiver")%>&nbsp;<%# Eval("Address") %></label>

                                                        </li>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </ul>
                                        </div>

                                    </li>


                                    <li style="position:relative; z-index:2; overflow:initial;"><span class="left_span">地址<font color="red"></font>：</span>
                                        <epc:TextBox runat="server" ID="tbaddress"  autocomplete="off" placeholder="请输入地图定位的地址" Width="300px" class="required-entry input_on"></epc:TextBox>
                                        <span>
                                            <input
                                                type="button" value="地图标注" onclick="showmap()" class="subBtn" />
                                        </span>

                                        <div id="result1" name="result1" style="width:305px;position:absolute;left:120px; top:34px;z-index:9999;border:1px double #ccc;border-top:none;; display:none;"></div>


                                    </li>
                                    <li id="trmap">

                                        <div style=" display: inline; float: left; height: 353px; margin: 18px 0 0 13px; width: 550px;"
                                            id="map">
                                            <div style="width: 650px; height: 353px; position: relative; "
                                                id="map_canvas">
                                            </div>
                                        </div>
                                        <asp:HiddenField runat="server" ID="hdState" />
                                        <div class="clear">
                                        </div>
                                    </li>

                                    <li><span class="left_span">详细地址<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbaddressdetail" placeholder="请输入详细地址" CanBeNull="必填" Width="300px" class="required-entry input_on"></epc:TextBox>
                                    </li>


                                    <li style="display: none;"><span class="left_span">送餐份数<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbfoodcount" CanBeNull="必填" Text="1"
                                            Width="90px" class="required-entry input_on"></epc:TextBox>
                                    </li>


                                    <li><span class="left_span">商品总金额<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbPrice" CanBeNull="必填" Text="" RequiredFieldType="数据校验"
                                            Width="90px" class="required-entry input_on"></epc:TextBox>
                                        元 </li>



                                    <li><span class="left_span">配送距离<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbcardpay" CanBeNull="必填" Text="0" RequiredFieldType="数据校验" Enabled="false"
                                            Width="90px" class="required-entry input_on"></epc:TextBox>
                                        公里 </li>


                                    <li><span class="left_span">配送费<font color="red">*</font>：</span>
                                        <epc:TextBox runat="server" ID="tbshopdiscountmoney" CanBeNull="必填" Text="" RequiredFieldType="数据校验"
                                            Width="90px" class="required-entry input_on" Enabled="false"></epc:TextBox>
                                        元 

                                <input type="button" value="计算配送费" id="btgetfee" onclick="startcur()" class="subBtn" />

                                        <div class="mynotice">计算配送费后才可以提交订单。</div>

                                    </li>


                                    <li><span class="left_span">票/券<font color="red">*</font>：</span>
                                        <asp:DropDownList runat="server" ID="ddlSystemUserId">
                                            <asp:ListItem Text="否" Value="0"></asp:ListItem>
                                            <asp:ListItem Text="是" Value="1"></asp:ListItem>

                                        </asp:DropDownList>
                                    </li>




                                    <li><span class="left_span">时间<font color="red">*</font>：</span>
                                        <asp:DropDownList
                                            runat="server" ID="ddltime" Width="60px" CssClass="j_seclect">
                                        </asp:DropDownList>
                                    </li>

                                    <li><span class="left_span">备注<font color="red"></font>：</span>
                                        <epc:TextBox runat="server" ID="tbremark" TextMode="MultiLine" Width="300px" class="required-entry input_on"></epc:TextBox>
                                        <div class="clear"></div>
                                        <div style="padding-left: 100px; margin-top: 11px;" class="quick_note_control">
                                            <asp:Repeater runat="server" ID="rptfastremark">
                                                <ItemTemplate>
                                                    <span onclick="settag(this)" mytag="<%#Eval("classname")%>">
                                                        <%# Eval("classname") %></span>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </div>
                                        <div class="clear"></div>
                                    </li>

                                    <li><span class="left_span">其他备注<font color="red"></font>：</span>
                                        <epc:TextBox runat="server" ID="tbcardids" TextMode="MultiLine" Width="300px" class="required-entry input_on"></epc:TextBox>
                                        <span></span>
                                    </li>

                                    <li class="padding90px">
                                        <div style="text-align: center;">
                                            <asp:Button Text="确定" runat="server" ID="btSave" OnClick="btSave_Click" class="subBtn"
                                                OnClientClick="showload_super();" />

                                        </div>
                                    </li>
                                </ul>
                            </div>

                        </div>
                    </div>

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <foot:foot runat="server" ID="foot" />
    </form>
</body>
</html>
<script type="text/javascript">

    //备注标签
    function settag(tag) {
        var or = $("#tbremark").val();
        $("#tbremark").val(or + " " + $(tag).attr("mytag"));
        $(tag).addClass("cull");
    }

    //选择地址
    function setaddress(evt) {

        $('input:radio[name="rbaddress"]').removeAttr("checked");
        evt.checked = true
        var v = evt.value + "";
        var names = v.split('^');
        //<%# Eval("Receiver") %>^<%# Eval("Address")%>^<%# Eval("lat") %>^<%# Eval("lng")%>^<%# Eval("dataid") %>^<%# Eval("BuildingID") %>^<%# Eval("Mobilephone")%>^<%# Eval("Phone") %>

        $("#add_dataid").val(names[4]);
        if (names[4] == "0") {
            return;
        }

        $("#tbname").val(names[0]);
        $("#tbaddressdetail").val(names[1]);
        $("#tbtel").val(names[6]);


        $("#hidLat").val(names[2]);
        $("#hidLng").val(names[3]);


        var _lat = parseFloat(names[2]);
        var _lng = parseFloat(names[3]);




    }

</script>
